	
	cap log close

*******************************************************************
/* title: eodb_replication_robustness_1_coup_activity_1_model_specification_OLS.do */
/* description: robustness analysis from economic origins of dictatorship and democracy OLS  */
/* authors: dan slater, ben smith, gautam nair */
*******************************************************************

	clear
	set mem 500m
	set more off
	pause on 
	vers 10.0

*******************************************************************
* SET DIRECTORY & USE DATASET
*******************************************************************

	* set directory to folder containing replication data
	* cd ""
	use "eodb_replication_data.dta"

*******************************************************************
* MODELS: OLS
*******************************************************************

	eststo clear

	* defining controls
	# delimit ;
	local controls_all 
	am_inc_gdp_ratio_l1
	wdi_ny_gdp_mktp_kd_zg_l1
	pwt_lngdppc_l1 
	pwt_kg_l1
	undp_manufacturing_share_l1 
	wdi_ny_gdp_totl_rt_zs_l1 
	wdi_log_population
	wdi_sp_pop_dpnd_ol_l1 
	pwt_openk_l1
	region_democ_cgv_gwf_l1
	coup_success_yrs_free_l1 
	time_trend_linear_l1 
	time_trend_quadratic_l1 
	time_trend_cubic_l1
	;
	# delimit cr

	* coup success + regime transition
	eststo: reg  coup_success_gwf `controls_all', cluster(ccode) robust

	* coup success
	eststo: reg  coup_success_n `controls_all', cluster(ccode) robust

	* coup attempt
	eststo: reg coup_attempt_n `controls_all', cluster(ccode) robust

	* coup plots + rumors
	eststo: reg coup_plot_rumor_n `controls_all', cluster(ccode) robust

	* coup success + regime transition
	eststo: reg  coup_success_gwf `controls_all' if  cgv_gwf_democracy_l1==1, cluster(ccode) robust

	* coup success
	eststo: reg  coup_success_n `controls_all' if  cgv_gwf_democracy_l1==1, cluster(ccode) robust

	* coup attempt
	eststo: reg coup_attempt_n `controls_all' if  cgv_gwf_democracy_l1==1, cluster(ccode) robust

	* coup plots + rumors
	eststo: reg coup_plot_rumor_n `controls_all' if  cgv_gwf_democracy_l1==1, cluster(ccode) robust

*******************************************************************
* MODELS: OLS fixed effects
*******************************************************************
	
	xtset ccode year

	* coup success + regime transition
	eststo: xtreg  coup_success_gwf `controls_all', fe robust

	* coup success
	eststo: xtreg  coup_success_n `controls_all', fe robust

	* coup attempt
	eststo: xtreg  coup_attempt_n `controls_all', fe robust

	* coup plots + rumors
	eststo: xtreg  coup_plot_rumor_n `controls_all', fe robust

	* coup success + regime transition
	eststo: xtreg  coup_success_gwf `controls_all' if  cgv_gwf_democracy_l1==1, fe robust

	* coup success
	eststo: xtreg  coup_success_n `controls_all' if  cgv_gwf_democracy_l1==1, fe robust

	* coup attempt
	eststo: xtreg  coup_attempt_n `controls_all' if  cgv_gwf_democracy_l1==1, fe robust

	* coup plots + rumors
	eststo: xtreg  coup_plot_rumor_n `controls_all' if  cgv_gwf_democracy_l1==1, fe robust

	* estout using "eodb_replication_robustness_1_coup_activity_1_model_specification_OLS.xls", cells(b(fmt(%9.4f) star) se(par(`"="("' `")""') fmt(4)) ) stats(N N_clust, fmt(0 0)) style(tab) starlevels(* 0.10 ** 0.05 *** 0.01)  replace
	* estout using "eodb_replication_robustness_1_coup_activity_1_model_specification_OLS_pvals.xls", replace cells(b(fmt(%9.3f) star) se(par(`"="("' `")""') fmt(3)) p(fmt(3)) ) stats(N N_g, fmt(0 0)) style(tab) starlevels(* 0.10 ** 0.05 *** 0.01)

*******************************************************************
* LOG CLOSE
*******************************************************************
	
	* log close

